/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package logging.report;

import pgentity.User;

/**
 *
 * @author KieuAnh
 */
public class PGRecord extends RecordImpl
{
    private final String uid;
    private final String level;
    private final String gold;
    private final String coin;

    public PGRecord(PGLogCategory category, User user, long time) {
        super(category, time);
        
        this.uid = user.getUid();
        this.level = String.valueOf(user.getLevel());
        this.gold = String.valueOf(user.getGold());
        this.coin = String.valueOf(user.getCoin());
    }

    public String getUid() {
        return uid;
    }

    public String getLevel() {
        return level;
    }

    public String getGold() {
        return gold;
    }

    public String getCoin() {
        return coin;
    }

    @Override
    protected int logFields()
    {
        return super.logFields() + 4;
    }
    
    @Override
    protected int logSize()
    {
        return uid.length() + level.length() + gold.length() + coin.length();
    }
    
    @Override
    protected void buildLog(StringBuilder builder)
    {
        super.buildLog(builder);
        logField(builder, uid);
        logField(builder, level);
        logField(builder, gold);
        logField(builder, coin);
    }
}